import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  main: {
    build: {
      rollupOptions: {
        external: ['sqlite3'],
        input: {
          index: resolve('src/main/index.js'),
          worker: resolve('src/main/worker.js'),
          batchTaskWorker: resolve('src/main/batchTaskWorker.js'),
          batchTaskSubmitTbWorker: resolve('src/main/batchTaskSubmitTbWorker.js'),
          'anti-debug': resolve('src/main/anti-debug.js')
        }
      }
    },
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    build: {
      rollupOptions: {
        input: {
          index: resolve('src/preload/index.js')
        }
      }
    },
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src')
      }
    },
    plugins: [vue()]
  }
})
